package com.qdhh.enrollment.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.time.Year;

/**
 * WeChat user profile synced from mini program logins.
 */
@TableName("users")
public class UserInfo {

    @TableId(value = "id", type = IdType.INPUT)
    private String openid;

    @TableField("nick")
    private String nickname;

    @TableField("avatar")
    private String avatar;

    @TableField("role")
    private String role;

    @TableField("gender")
    private String gender;

    @TableField("enrollment_year")
    private Integer enrollmentYear;

    public String getOpenid() {
        return openid;
    }

    public void setOpenid(String openid) {
        this.openid = openid;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public Integer getEnrollmentYear() {
        return enrollmentYear;
    }

    public void setEnrollmentYear(Integer enrollmentYear) {
        if (enrollmentYear != null) {
            Year.parse(enrollmentYear.toString());
        }
        this.enrollmentYear = enrollmentYear;
    }
}
